﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Template</title>
        <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
        <script src="~/Scripts/js/jquery.min.js"></script>
        <script src="~/Scripts/js/bootstrap.min.js"></script>
        <style>
            #ul li {
                color: #4b69cb;
                font-weight: bolder;
                padding: 8px 20px;
                margin-right: 20px;
            }

                #ul li a {
                    text-decoration: none;
                }

            #ul {
                list-style: none;
            }
        </style>

    </head>
    <body style="background-color:#f1ebeb">
        <div id="AlertInfo" class="container" style="width:1000px;position:absolute;margin-left:13%;margin-top:50px;font-weight:bolder">

        </div>
        @*<script>
            $(function () {
                LoadData();
            })

            function LoadData() {
                $.ajax({
                    type: "post",
                    url: "/Employee/GetLimitInfo",
                    success: function (obj) {
                        alert(obj);
                        obj = eval("" + obj + "");
                        //var ul = createTree(obj, 0);

                        $("#continer").empty().append(ul);

                        //控制菜单的隐藏显示
                        $("ul[class] li").each(function () {
                            $(this).click(function () {
                                $(this).next().toggle();
                            });
                        });
                    }
                })


            }

            //主方法，运用递归实现
            function createTree(jsons, pid) {
                if (jsons != null) {
                    var ul = '<ul id="ul" class="">';
                    for (var i = 0; i < jsons.length; i++) {
                        if (jsons[i].Pid == pid) {
                            ul += '<li><a href="' + jsons[i].url + '">' + jsons[i].menuname + "</a></li>";
                            ul += createTree(jsons, jsons[i].menuid);
                        }
                    }
                    ul += "</ul>";
                }
                return ul;
            }

        </script>*@
        <div id="NormalPage" class="container">
            <div class="row">
                <div class="col-md-3" id="continer">

                </div>
                <div class="col-md-9">
                    <div class="row">
                        <div style="margin-top:20px;" class="pull-right"><iframe name="weather_inc" src="http://i.tianqi.com/index.php?c=code&id=11" width="400" height="20" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">@RenderBody()</div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    </html>
<script>
        $(function () {
            LoadPage();
            LoadEducation();
            LoadPolitical();
        })
        //加载页面，母版页
        function LoadPage() {
            $.ajax({
                type: "post",
                url: "/Employee/ShowBasicInfo",
                success: function (obj) {
                    if (obj == -1) {
                        location.href = '/Employee/CompleteInfo';
                    }
                    switch (obj) {
                        case "0":
                            $("#AlertInfo").hide();
                            $("#NormalPage").show();
                            break;
                        case "-1":
                            location.href = '/Employee/CompleteInfo';
                            break;
                        case "1":
                            $("#NormalPage").hide();
                            $("#AlertInfo").show();
                            $("#AlertInfo").html("<h2>正在审核中，请稍等。。。</h2>")
                            break;
                        case "2":
                            $("#NormalPage").hide();
                            $("#AlertInfo").show();
                            $("#AlertInfo").html("<h2>信息核对失败，请重新提交。<a href='/Employee/CompleteInfo'>点击进入</a></h2>")
                            break;
                        default:
                            location.href = '/Employee/Login';
                    }
                }
            })
        }

        //加载学历
        function LoadEducation() {
            $.ajax({
                type: "post",
                url: "/Employee/GetEducationList",
                success: function (obj) {
                    obj = JSON.parse(obj);
                    var str = "";
                    for (var i = 0; i < obj.length; i++) {
                        str += "<option value='" + obj[i].EducationID + "'>" + obj[i].EducationName + "</option>"
                    }
                    $("#txtEducationID").html("<option value='0'>请选择</option>" + str);
                }
            })
        }

        //加载政治面貌
        function LoadPolitical() {
            $.ajax({
                type: "post",
                url: "/Employee/GetPoliticalList",
                success: function (obj) {
                    obj = eval("" + obj + "");
                    var str = "";
                    for (var i = 0; i < obj.length; i++) {
                        str += "<option value='" + obj[i].PoliticalID + "'>" + obj[i].PoliticalName + "</option>"
                    }
                    $("#txtPoliticalID").html("<option value='0'>请选择</option>" + str);
                }
            })
        }

    </script>